import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login.vue'
import Register from '../views/Register.vue'
import Panel from '../views/Panel.vue';
import Home from '../components/Home.vue';


Vue.use(VueRouter)

const routes = [
  // 重定向login
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/register',
    component: Register
  },


  {
    path: '/panel',
    name: '首页',
    component: Panel,
    redirect: '/panel/home',
    children: [
      {
        path: '/panel/home',
        iconClass:'el-icon-s-home',
        name: '首页',
        component: Home,
      },
    ]
  },
  {
    path: '/system',
    name: '系统管理',
    iconClass: 'el-icon-setting',
    component: Panel,
    children: [
      {
        path: '/system/usermanage',
        name: '用户管理',
        iconClass: 'el-icon-user-solid',
        component: () => import('../components/systemmanage/usermanage')
      },
      {
        path: '/system/rolemanage',
        iconClass: 'el-icon-s-custom',
        name: '角色管理',
        component: () => import('../components/systemmanage/rolemanage')
      },
      {
        path: '/system/menumanage',
        name: '菜单管理',
        iconClass: 'el-icon-menu',
        component: () => import('../components/systemmanage/menumanage')
      }
    ]
  },
  {
    path: '/playbill',
    name: '海报管理',
    component: Panel,
    children: [
      {
        path: '/playbill',
        name: '海报管理',
        iconClass: 'el-icon-picture',
        component: () => import('../components/playbill/playbill')
      },
    ]
  },
  {
    path: '/material',
    name: '素材管理',
    component: Panel,
    children: [
      {
        path: '/material',
        name: '素材管理',
        iconClass: 'el-icon-document',
        component: () => import('../components/playbill/playbill')
      },
    ]
  },
]

const router = new VueRouter({
  routes
})

export default router
